//
// Created by none98 on 2021/9/22.
//

#ifndef LOGINSERVER_PLAYERBIN_H
#define LOGINSERVER_PLAYERBIN_H

#include <mutex>
#include <vector>

class Position{
public:
    Position():
        x(0),
        y(0),
        z(0)
    {
    }

    Position(int x,int y,int z):
            x(x),
            y(y),
            z(z)
    {
    }

    std::vector<int> Get();
    void Set(int x, int y, int z);
private:
    std::mutex valMutex;
    int x;
    int y;
    int z;
};



class PlayerBin {
public:
    PlayerBin();
    ~PlayerBin() = default;

    Position* GetPosition(){
        return &position;
    }

    void SetName(const std::string &name){
    	std::unique_lock<std::mutex> lock(nameMutex);
	    this->name = name;
    }
    std::string GetName(){
     	std::unique_lock<std::mutex> lock(nameMutex);
	   return this->name;
    }
private:
    Position position;
    std::mutex nameMutex;
    std::string name;
};



#endif //LOGINSERVER_PLAYERBIN_H
